package cn.fuxi2022.qiniu.properties;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 微信支付配置 + 社费配置
 */
@Component
public class QiNiuProperties implements InitializingBean {

    @Value("${qiniu.accessKey}")
    private String accessKey;

    @Value("${qiniu.secretKey}")
    private String secretKey;

    @Value("${qiniu.bucket}")
    private String bucket;

    @Value("${qiniu.cdn}")
    private String cdn;

    /**
     * 授权凭证的签算 ACCESSKEY
     */
    public static String ACCESSKEY;

    /**
     * 授权凭证的签算 SECRETKEY
     */
    public static String SECRETKEY;

    /**
     * 空间名称
     */
    public static String BUCKET;


    /**
     * 七牛融合 CDN 测试域名,将其与文件名拼接即可获取文件访问地址（后面需要携带/）
     */
    public static String CDN;

    @Override
    public void afterPropertiesSet() {
        ACCESSKEY = accessKey;
        SECRETKEY = secretKey;
        BUCKET = bucket;
        CDN = cdn;
    }
}